package com.weigee.ktv.m.util;

import android.content.Context;

import com.lcodecore.tkrefreshlayout.RefreshListenerAdapter;
import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout;
import com.lcodecore.tkrefreshlayout.header.bezierlayout.BezierLayout;

/**
 * Created by 林德 on 2017/4/14 10:50.
 * <p/>
 *
 * @deprecated use {@link com.l.d.app.library.util.ListUtil#initTwinklingRefresh(TwinklingRefreshLayout, RefreshListenerAdapter)}
 */
@Deprecated
public class RefreshUtil {
    public static <L extends RefreshListenerAdapter> void initTwinklingRefresh(TwinklingRefreshLayout refreshLayout, L listener) {
        if (refreshLayout == null) return;
        final Context context = refreshLayout.getContext();
        final BezierLayout header = new BezierLayout(context);
//        final SinaRefreshView header = new SinaRefreshView(context);

        refreshLayout.setHeaderView(header);
        // 允许越界回弹
        refreshLayout.setEnableOverScroll(true);
        // 不允许在越界的时候显示刷新控件
        refreshLayout.setOverScrollTopShow(false);
        refreshLayout.setOverScrollBottomShow(false);
        // 允许下拉刷新
        refreshLayout.setEnableRefresh(true);
        refreshLayout.setEnableLoadmore(false);
        // 刷新监听
        refreshLayout.setOnRefreshListener(listener);
    }
}
